/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.CustomerManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.thread.DeleteCustomerThread;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.sql.SQLException;
/*    */ import javax.servlet.RequestDispatcher;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class DeleteImportCustomer extends AbstractAction
/*    */ {
/* 29 */   private static Logger logger = Logger.getLogger(DeleteImportCustomer.class
/* 30 */     .getName());
/*    */ 
/* 32 */   private int id = 0;
/* 33 */   private String indexPath = null;
/*    */ 
/*    */   public DeleteImportCustomer(AbstractHttpServlet servlet, String id, String indexPath)
/*    */   {
/* 37 */     super(servlet);
/* 38 */     this.id = Util.str2Int(id);
/* 39 */     this.indexPath = indexPath;
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 46 */     User u = super.getLoginUser(request);
/*    */ 
/* 49 */     if (!u.isCanDelete()) {
/* 50 */       request.getRequestDispatcher("/nopermission.jsp").forward(
/* 51 */         request, response);
/* 52 */       return;
/*    */     }
/*    */ 
/* 55 */     CustomerManager manager = new CustomerManager();
/*    */     try
/*    */     {
/* 58 */       manager.clearImportCustomers(this.id, u.isAdmin, u.userId, 
/* 59 */         u.companyId);
/*    */ 
/* 62 */       new Thread(new DeleteCustomerThread(this.indexPath)).start();
/*    */     }
/*    */     catch (DBException e) {
/* 65 */       logger.warn("delete import customers failed", e);
/*    */     } catch (SQLException e) {
/* 67 */       logger.warn("delete import customers failed", e);
/*    */     }
/* 69 */     response.sendRedirect(request.getContextPath() + "/parties");
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.DeleteImportCustomer
 * JD-Core Version:    0.6.1
 */